/*
题目链接 : https://leetcode.cn/problems/convert-an-array-into-a-2d-array-with-conditions/description/?envType=daily-question&envId=2025-03-19
*/

//题解代码 : 
class Solution {
public:
    vector<vector<int>> findMatrix(vector<int>& nums) {
        map<int,int> mp;
        int m = 0;
        for(auto& x : nums) m=max(m,++mp[x]);
        vector<vector<int>> ans(m);
        for(auto& it : mp){
            int n = it.second;
            for(int i=0;i<n;++i){
                ans[i].push_back(it.first);
            }
        }
        return ans;
    }
};
